var app=getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: null,
    correct:0,
    wrong:0,
    score:0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function () {
    
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.getreloadLog();
  },
  getreloadLog: function () {
    wx.request({
      url: 'https://tally.slickghost.com/demo2/Answer/selectAnswer',
      data: {
        openID: app.globalData.openid
      },
      method: 'get',
      success: function (res) {
        if (res.data.length !== 0) {
          app.globalData.correct = res.data[0].correctCount;
          app.globalData.wrong = res.data[0].errorCount;
          app.globalData.score = res.data[0].score;
        } else {
          app.globalData.correct = 0;
          app.globalData.wrong = 0;
          app.globalData.score = 0;
        }
      }
    });
    this.setData({
      userInfo: app.globalData.userInfo,
      correct: app.globalData.correct,
      wrong: app.globalData.wrong,
      score: app.globalData.score,
    });
  }
})
